﻿#if 0
#define _CRT_SECURE_NO_WARNINGS
#include<Windows.h>
#include<stdio.h>
#include<stdbool.h>
//定义宏让光标指向设置的地方
void Set_pos(Handle,x,y)
{
	COORD pos = { x,y };
	SetConsoleCursorPosition(Handle, pos);
}
#if 0
int main()
{
	//改变窗口名字
	system("title 贪吃蛇");
	//改变窗口大小
	system("mode con cols=150 lines=40");

	system("pause");
	//WindowsAPI
	//coord坐标
	COORD pos = { 0,0 };
	COORD pos1 = { 30,20 };
	//pos pos1指向的位置就是0 0， 30 20
	HANDLE houtput = GetStdHandle(STD_OUTPUT_HANDLE);
	//
	CONSOLE_CURSOR_INFO cursor_info = { 0 };
	GetConsoleCursorInfo(houtput, &cursor_info);//得到光标信息
	printf("%d\n", cursor_info.bVisible);
	printf("%d\n", cursor_info.dwSize);
	cursor_info.dwSize = 50;//设置光标大小
	//cursor_info.bVisible = false;//设置光标可见度
	SetConsoleCursorInfo(houtput, &cursor_info);//更改光标信息
	//更改光标指向位置
	system("pause");
	//更改光标指向位置
	SetConsoleCursorPosition(houtput, pos1);//po130 20
	getchar();
	COORD pos2 = { 30,21 };
	SetConsoleCursorPosition(houtput, pos2);//po130 20
	int x = 40,y = 30;
	Set_pos(houtput, x, y);
	system("pause");
	//获取键盘上的按键情况getasynkeystate
	//按过最低位为1 否者为0，还在按的最高位为1 否者为0
	if (KEY_PRESS(0x35))
		printf("5");
	system("pause");
	return 0;
}
#endif
#define KEY_PRESS(vk) ((GetAsyncKeyState(vk) & 0x1) == 1 ? 1:0) 
#include<time.h>
#include<locale.h>
int main()
{
	//printf("%s", asctime(newtime));*/
	/*system("pause");
	while(1)
	if (KEY_PRESS(0x35))
		printf("5 beianle");*/
	//配置本地语言 长字符的打印setlocale
	//do
//{
//	printf("now locale is %s\n",setlocale(LC_ALL, NULL));
//	printf("now locale Data %s\n", asctime(newtime));
//	setlocale(LC_ALL, "");//配置当前环境语言
//} while (!twice++);
	time_t times;
	time(&times);
	int twice = 0;
	struct st* newtime = localtime(&times);	
	char arr[1000] = { 0 };
	do
	{
		strftime(arr, 80,"%c",newtime);
		printf("now locale is %s\n", setlocale(LC_ALL, NULL));
		printf("now locale Data %s\n", arr);
		setlocale(LC_ALL, "");//配置当前环境语言
		times++; 
		newtime = localtime(&times);
	} while (!twice++);
	return 0;
}

#if 0
#include<time.h>
#include<locale.h>
//宽字符打印
int main()
{
	setlocale(LC_ALL, "");
	wchar_t ch1 = L'■';
	wprintf(L"%1c\n", ch1);
	return 0;
}
#endif


#endif